
// zi定义Hook的封装
import { useEffect, useState } from 'react'
function useValue() {
  const [value, setValue] = useState(true)
  const handleChange = () => {
    setValue(!value)
  }
  return{
    value,
    handleChange}
}
function App(){
  const {value,handleChange}=useValue()
  return(
    <div>
      {value && <div>this is div</div>}
      <button onClick={handleChange}>click me</button>
    </div>
  )
}
export default App